#include "qbooleditor.h"

#include "../../libs/sharedLib/qabstractproperty.h"

QBoolEditor::QBoolEditor(SHAREDLIB::QAbstractProperty *pro):
    SHAREDLIB::QEditorLabel(pro)
{
    setValue(pro->getValue().toBool());
    connect(pro,SIGNAL(valueChanged()),this,SLOT(value_changed()));
}

void QBoolEditor::mousePressEvent(QMouseEvent *)
{
    setValue(!m_value);
}

bool QBoolEditor::value()
{
    return m_value;
}

void QBoolEditor::setValue(bool v)
{
    m_value=v;
    m_property->setSignalValue(m_value);
}

void QBoolEditor::value_changed()
{
    m_value=m_property->getValue().toBool();
    this->update();
}
